﻿using System;
using ZX.Common;
using ZX.DBModule;
using ZX.Web.UI.Controls;
using ZX.BLL.Extend;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.Linq;
using ZX.Common.Extend;

namespace ZX.WebApp
{
    public partial class MasterDetail :  MasterDetailPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           // InitPage();
        }
        //    string strEntity = this.GetStringFromQueryString("entity", "E_Menu");
        //    string id = this.GetStringFromQueryString("id", "");
        //    BaseEntity instance = ZX.Common.Globals.getEntity(strEntity) as BaseEntity;
        //    BaseBussnies bInstance = new BLL.Extend.BaseBussnies(instance);
        //    BaseEntity entity = bInstance.GetEntityById(id) as BaseEntity;
        //    this.EditTemplate.Text = CreateHtml(instance, entity);


        //    EditUIConfig ConfigEntity = EditUIConfig.New();
        //    bInstance.entity = ConfigEntity;
        //    bInstance.Order = "iOrder";
        //    string formReForm = this.GetStringFromQueryString("formReForm", "false");

        //    IList<EditUIConfig> list = bInstance.GetEntitys<EditUIConfig>("EntityName='" + strEntity + "'");
        //    int? ColIndex = list.Max(p => p.ColumnIndex);
        //    StringBuilder strHtml = new StringBuilder();
        //    if (!string.Equals(formReForm, "false"))
        //    {
        //        strHtml.Append(CreateEditReForm(list));
        //    }
        //    else
        //    {
        //        strHtml.Append("<Table id=\"EditForm\"><tr>");
        //        for (int i = 0; i < ColIndex + 1; i++)
        //        {
        //            strHtml.Append("<td valign=‘top’ id=\"Col" + i.ToString() + "\"> ");

        //            if (entity == null)
        //            {
        //                strHtml.Append(CreateEditForm(list.Where(p => p.ColumnIndex == i).ToList()));
        //            }
        //            else
        //            {
        //                strHtml.Append(CreateEditForm(entity, list.Where(p => p.ColumnIndex == i).ToList()));
        //            }
        //            strHtml.Append("</td>");
        //        }
        //        strHtml.Append("</tr></table>");
        //    }
        //    FormTemplate.Text = strHtml.ToString();
        //    this.jSave.Text = CreateScript(list);
        //    this.jInitControl.Text = InitControl(list);
        //    this.MasterID.Text = SetMasterID();
        //}


        //public string BlankInstance
        //{
        //    get
        //    {
        //       object o =   Reflection.CreateEntitysInstance(SubEntityName);
        //       return ZX.Common.Globals.ObjectToJSON(o);
        //    }
        //}
    }
}